package com.yezi.lampcourt.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.Button;
import android.widget.ImageView;

import com.yezi.lampcourt.R;
import com.yezi.lampcourt.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class WelcomeActivity extends BaseActivity {


    @BindView(R.id.iv_welcome)
    ImageView ivWelcome;
    @BindView(R.id.btn_link)
    Button btnLink;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        ButterKnife.bind(this);
        init();
    }

    @Override
    protected void init() {
        handler.sendEmptyMessageDelayed(1, 3000);
    }

    @OnClick(R.id.btn_link)
    public void onViewClicked() {
        linkToList();
    }

    private void linkToList() {
        handler.removeMessages(1);
        Intent intent = new Intent(WelcomeActivity.this, CourtListActivity.class);
        startActivity(intent);
        finish();
    }

    private Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            linkToList();
        }
    };


}
